<?php

function fileList($dirpath, $length = NULL)
{
    if (is_null($length)) {
        $length = strlen($dirpath);
    }
    $dir = dir($dirpath);
    while (false !== ($read = $dir->read())) {
        if (substr($read,0,1) == '.') {
            continue;
        }
        if (is_dir($dirpath.$read.'/')) {
            call_user_func(__FUNCTION__,$dirpath.$read.'/',$length);
        } elseif (substr($read,-3,3)=='php') {
            list($class,,) = explode('.',$read);
            echo ($class?"'".$class."' => ":'')."'".substr($dirpath.$read,$length)."',
";
        }
    }
    $dir->close();
}
echo 'array(
';
fileList('D:/PHP/Phlame/0.1/');
echo ');';